package com.liangwj.springbootdesignpatterns.structureTypePatterns.filter;

import java.util.ArrayList;
import java.util.List;

/**
 * <b>Description:</b> 实现了Criteria的另一个标准实体类 <br/>
 * @author Lingwenjun
 * @date 2019/1/24-16:53
 * @version 1.0
 */
public class CriteriaFemale implements Criteria{
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> femalePersons = new ArrayList<>();

        for (Person person : persons) {
            if (person.getGender().equalsIgnoreCase("female")) {
                femalePersons.add(person);
            }
        }
        return femalePersons;
    }
}
